Unit WaitMsg;

Interface

Uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, ExtCtrls, ComCtrls, fcLabel, fcpanel, cxControls, cxContainer,
  cxEdit, cxProgressBar, Inifiles, Buttons, siComp;

Type
  TfmWaitMsg = Class(TForm)
    Panel1: TPanel;
    stTimer: TStaticText;
    avWait: TAnimate;
    lbCap: TfcLabel;
    txtDetail: TfcLabel;
    paPosition: TfcPanel;
    lbPosition: TfcLabel;
    Panel4: TPanel;
    fcPanel2: TfcPanel;
    fcPanel3: TfcPanel;
    fcPanel4: TfcPanel;
    fcPanel5: TfcPanel;
    PB: TcxProgressBar;
    paMax: TfcPanel;
    lbMax: TfcLabel;
    paTersSlas: TfcPanel;
    fcLabel1: TfcLabel;
    tmrSleep: TTimer;
    imgDikkat: TImage;
    cbxOpsion: TCheckBox;
    btUyariOnay: TBitBtn;
    Procedure FormCreate(Sender: TObject);
    Procedure FormActivate(Sender: TObject);
    Procedure FormKeyPress(Sender: TObject; Var Key: Char);
    Procedure FormShow(Sender: TObject);
    Procedure FormMouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    Procedure tmrSleepTimer(Sender: TObject);
    Procedure FormClose(Sender: TObject; Var Action: TCloseAction);
    Procedure btUyariOnayClick(Sender: TObject);
  Private
    NowTime: TDateTime;

  Public
    Canceled: Boolean;
    Value1: String;
    Procedure UpdateTimer;
  End;

Var
  fmWaitMsg: TfmWaitMsg;

Implementation

uses ana1;

//Uses Unitkr;
{$R *.DFM}

Procedure TfmWaitMsg.FormCreate(Sender: TObject);
Begin
  NowTime := Now;
  stTimer.Caption := TimeToStr(NowTime);
  avWait.CommonAVI := aviFindComputer;
  avWait.Active := True;
End;

Procedure TfmWaitMsg.UpdateTimer;
Begin
  stTimer.Caption := TimeToStr(NowTime - Now);
  stTimer.Refresh;
End;

Procedure TfmWaitMsg.FormActivate(Sender: TObject);
Begin
  Refresh;
End;

Procedure TfmWaitMsg.FormKeyPress(Sender: TObject; Var Key: Char);
Begin
  If Key = Char(27) Then
  Begin
    Canceled := True;
    Close;
  End;
End;

Procedure TfmWaitMsg.FormShow(Sender: TObject);
Begin
  Canceled := False;
End;

Procedure TfmWaitMsg.FormMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
Const
  SC_DragMove = $F012;
Begin
  ReleaseCapture;
  Self.perform(WM_SysCommand, SC_DragMove, 0);

  If ssCtrl In Shift Then
    If Button = mbRight Then
    Begin
      Canceled := True;
      Close;
    End;
End;

Procedure TfmWaitMsg.tmrSleepTimer(Sender: TObject);
Begin
  tmrSleep.Enabled := False;
  If Assigned(fmWaitMsg) Then
  Begin
    fmWaitMsg.Close;
    fmWaitMsg.Free;
    fmWaitMsg := Nil;
  End;
End;

Procedure TfmWaitMsg.FormClose(Sender: TObject; Var Action: TCloseAction);
Var
  ini: TIniFile;
Begin
  //ini := Nil;
  If cbxOpsion.Checked Then
  Begin
    Try
      //ini := TIniFile.Create(Dizin + 'parity.x32');
      //ini.WriteString('OpsionUyari', Value1, '1');
    Finally
      //ini.Free;
    End;
  End;
End;

Procedure TfmWaitMsg.btUyariOnayClick(Sender: TObject);
Begin
  tmrSleep.Enabled := False;
  If Assigned(fmWaitMsg) Then
  Begin
    fmWaitMsg.Close;
    fmWaitMsg.Free;
    fmWaitMsg := Nil;
  End;
End;

End.